#include <uiFactory.h>

#include <normalButton.h>
#include <imageButton.h>

#include <normalWindow.h>

#include <normalCanvas.h>

#include <normalEntry.h>

#include <normalTextFeild.h>

#include <normalLabel.h>

#include <normalRadioSelector.h>

#include <normalMultipleSelector.h>

namespace lgb_gtk
{

  UIFactory *UIFactory::instance = NULL;

  UIFactory::UIFactory()
  {
    
  }

  UIFactory::~UIFactory()
  {

  }

  UIFactory *UIFactory::GetInstance()
  {
    if( NULL == instance )
      instance = new UIFactory();
    return instance;    
  }

  Window *UIFactory::CreateWindow(WindowStyle style)
  {
    Window *window = NULL;
    switch(style)
      {
      case WINDOW_NORMAL:window = new NormalWindow();break;
      default:window = NULL;break;
      }
    return window;
  }
  
  Canvas *UIFactory::CreateCanvas(CanvasStyle style)
  {
    Canvas *canvas = NULL;
    switch(style)
      {
      case CANVAS_NORMAL:canvas = new NormalCanvas();break;
      default:canvas = NULL;break;
      }
    return canvas;
  }

  Button *UIFactory::CreateButton(ButtonStyle style)
  {
    Button *button = NULL;
    switch(style)
      {
      case BUTTON_NORMAL:button = new NormalButton();break;
      case BUTTON_IMAGE:button = new ImageButton();break;
      default:button = NULL;break;
      }
    return button;
  }

  Entry *UIFactory::CreateEntry(EntryStyle style)
  {
    Entry *entry = NULL;
    switch(style)
      {
      case ENTRY_NORMAL:entry = new NormalEntry();break;
      default:entry = NULL;break;
      }
    return entry;
  }

  TextFeild *UIFactory::CreateTextFeild(TextFeildStyle style)
  {
    TextFeild *textFeild = NULL;
    switch(style)
      {
      case TEXTFEILD_NORMAL:textFeild = new NormalTextFeild();break;
      default:textFeild = NULL;break;
      }
    return textFeild;
  }

  Label *UIFactory::CreateLabel(LabelStyle style)
  {
    Label *label = NULL;
    switch(style)
      {
      case LABEL_NORMAL:label = new NormalLabel();break;
      default:label = NULL;break;
      }
    return label;
  }

  RadioSelector *UIFactory::CreateRadioSelector(RadioSelectorStyle style)
  {
    RadioSelector *selecter = NULL;
    switch(style)
      {
      case RADIO_SELECTOR_NORMAL:selecter = new NormalRadioSelector();break;
      default:selecter = NULL;
      }
    return selecter;
  }

  MultipleSelector *UIFactory::CreateMultipleSelector(MultipleSelectorStyle style)
  {
    MultipleSelector *selecter = NULL;
    switch(style)
      {
      case MULTIPLE_SELECTOR_NORMAL:selecter = new NormalMultipleSelector();break;
      default:selecter = NULL;
      }
    return selecter;
  }

}
